import service from '@/utils/request'
// @Router /role/getRoleList [post]
export const getRoleList = (data) => {
  return service({
    url: '/role/getRoleList',
    method: 'post',
    data
  })
}

// @Summary 删除角色
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body {roleId uint} true "删除角色"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /role/deleteRole [post]
export const deleteRole = (data) => {
  return service({
    url: '/role/deleteRole',
    method: 'post',
    data
  })
}

// @Summary 创建角色
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.saveRolePatams true "创建角色"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /role/saveRole [post]
export const saveRole = (data) => {
  return service({
    url: '/role/saveRole',
    method: 'post',
    data
  })
}

export const getRoleMenuList = (params) => {
  return service({
    url: '/role/getRoleMenuList',
    method: 'get',
    params
  })
}

export const saveRoleMenuList = (data) => {
  return service({
    url: '/role/saveRoleMenuList',
    method: 'post',
    data
  })
}


// @Summary 设置角色资源权限
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body sysModel.SysAuthority true "设置角色资源权限"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
// @Router /authority/setDataAuthority [post]
export const setDataAuthority = (data) => {
  return service({
    url: '/authority/setDataAuthority',
    method: 'post',
    data
  })
}

export const saveRoleDefaultMenu = (data) => {
  return service({
    url: '/role/saveRoleDefaultMenu',
    method: 'post',
    data
  })
}
